package net.asfun.jvalog.vo;

import static net.asfun.jvalog.common.log.logger;
import net.asfun.jvalog.resource.MapDao;


public class Setting {
	
	public static String TIMEZONE = "GMT+8";
	public static int SIZE_RSS = 20;
	public static int SIZE_ATOM = 20;
	public static int SIZE_MAP = 50;
	public static int SIZE_PAGE = 10;
	public static int SIZE_RECENT_POST = 5;
	public static int SIZE_RECENT_COMM = 5;
	public static int NEED_CHECK_COMM = 1;//0 false, else true;
	public static String WEB_ROOT;
	
	static {
		reset();
	}
	
	public static void reset() {
		int tz = MapDao.getTimezone();
		if ( tz > 12 || tz < -12) {
			tz = 8;
		}
		if ( tz > 0 ) {
			TIMEZONE = "GMT+" + tz;
		} else {
			TIMEZONE = "GMT" + tz;
		} 
		SIZE_RSS = MapDao.getRssSize();
		SIZE_ATOM = MapDao.getAtomSize();
		SIZE_MAP = MapDao.getMapSize();
		SIZE_PAGE = MapDao.getPageSize();
		if ( SIZE_PAGE < 2 ) {
			SIZE_PAGE = 10;
		}
		SIZE_RECENT_POST = MapDao.getRecentPosts();
		SIZE_RECENT_COMM = MapDao.getRecentComms();
		NEED_CHECK_COMM = MapDao.getCheckComm();
		logger.info("*********************reset setting data");
	}

}
